package simplefactory

import "fmt"

type SimpleAPI interface {
	Say(content string) string
}

type Chinese struct {}

func (c *Chinese) Say(content string) string {
	fmt.Println("this is Chinese method")
	return string("cn")
}

type English struct {}

func (e *English) Say(content string) string {
	fmt.Println("this is English method")
	return string("en")
}

func NewAPI(apiName string) SimpleAPI {
	if apiName == "cn" {
		return &Chinese{}
	} else if apiName == "en" {
		return &English{}
	}
	return nil
}